﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Options.IBClient.Component
{
    public class ErrorHandler
    {

        public static void WriteException(OptionsException ex)
        {
            WriteExceptionToLog(ex);
            SendNotification(ex);
        }

        public static void WriteExceptionToLog(OptionsException ex)
        {
            Log.LogMessage("Time Called: " + DateTime.Now.ToString());
            Log.LogMessage("Error Message: " + ex.Message.ToString());
            Log.LogMessage("Stack Trace: " + ex.StackTrace);

        }



        private static void SendNotification(OptionsException ex)
        {
            SendEmail notify = new SendEmail();
            notify.Notify(null, null, Common.To, null, null, "Exception occured delta options computation.", ex.Message.ToString(), Common.smtpclient);
        }
    }
}

